home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / stdio.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-05-08  |  27.3 KB  |  839 lines

  1. /* Define ISO C stdio on top of C++ iostreams.
  2.    Copyright (C) 1991,1994-2002,2003,2004 Free Software Foundation, Inc.
  3.    This file is part of the GNU C Library.
  4.  
  5.    The GNU C Library is free software; you can redistribute it and/or
  6.    modify it under the terms of the GNU Lesser General Public
  7.    License as published by the Free Software Foundation; either
  8.    version 2.1 of the License, or (at your option) any later version.
  9.  
  10.    The GNU C Library is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    Lesser General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU Lesser General Public
  16.    License along with the GNU C Library; if not, write to the Free
  17.    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18.    02111-1307 USA.  */
  19.  
  20. /*
  21.  *    ISO C99 Standard: 7.19 Input/output    <stdio.h>
  22.  */
  23.  
  24. #ifndef _STDIO_H
  25.  
  26. #if !defined __need_FILE && !defined __need___FILE
  27. # define _STDIO_H    1
  28. # include <features.h>
  29.  
  30. __BEGIN_DECLS
  31.  
  32. # define __need_size_t
  33. # define __need_NULL
  34. # include <stddef.h>
  35.  
  36. # include <bits/types.h>
  37. # define __need_FILE
  38. # define __need___FILE
  39. #endif /* Don't need FILE.  */
  40.  
  41.  
  42. #if !defined __FILE_defined && defined __need_FILE
  43.  
  44. __BEGIN_NAMESPACE_STD
  45. /* The opaque type of streams.  This is the definition used elsewhere.  */
  46. typedef struct _IO_FILE FILE;
  47. __END_NAMESPACE_STD
  48. #if defined __USE_LARGEFILE64 || defined __USE_SVID || defined __USE_POSIX \
  49.     || defined __USE_BSD || defined __USE_ISOC99 || defined __USE_XOPEN \
  50.     || defined __USE_POSIX2
  51. __USING_NAMESPACE_STD(FILE)
  52. #endif
  53.  
  54. # define __FILE_defined    1
  55. #endif /* FILE not defined.  */
  56. #undef    __need_FILE
  57.  
  58.  
  59. #if !defined ____FILE_defined && defined __need___FILE
  60.  
  61. /* The opaque type of streams.  This is the definition used elsewhere.  */
  62. typedef struct _IO_FILE __FILE;
  63.  
  64. # define ____FILE_defined    1
  65. #endif /* __FILE not defined.  */
  66. #undef    __need___FILE
  67.  
  68.  
  69. #ifdef    _STDIO_H
  70. #define _STDIO_USES_IOSTREAM
  71.  
  72. #include <libio.h>
  73.  
  74. #ifdef __USE_XOPEN
  75. # ifdef __GNUC__
  76. #  ifndef _VA_LIST_DEFINED
  77. typedef _G_va_list va_list;
  78. #   define _VA_LIST_DEFINED
  79. #  endif
  80. # else
  81. #  include <stdarg.h>
  82. # endif
  83. #endif
  84.  
  85. /* The type of the second argument to `fgetpos' and `fsetpos'.  */
  86. __BEGIN_NAMESPACE_STD
  87. #ifndef __USE_FILE_OFFSET64
  88. typedef _G_fpos_t fpos_t;
  89. #else
  90. typedef _G_fpos64_t fpos_t;
  91. #endif
  92. __END_NAMESPACE_STD
  93. #ifdef __USE_LARGEFILE64
  94. typedef _G_fpos64_t fpos64_t;
  95. #endif
  96.  
  97. /* The possibilities for the third argument to `setvbuf'.  */
  98. #define _IOFBF 0         /* Fully buffered.  */
  99. #define _IOLBF 1        /* Line buffered.  */
  100. #define _IONBF 2        /* No buffering.  */
  101.  
  102.  
  103. /* Default buffer size.  */
  104. #ifndef BUFSIZ
  105. # define BUFSIZ _IO_BUFSIZ
  106. #endif
  107.  
  108.  
  109. /* End of file character.
  110.    Some things throughout the library rely on this being -1.  */
  111. #ifndef EOF
  112. # define EOF (-1)
  113. #endif
  114.  
  115.  
  116. /* The possibilities for the third argument to `fseek'.
  117.    These values should not be changed.  */
  118. #define SEEK_SET    0    /* Seek from beginning of file.  */
  119. #define SEEK_CUR    1    /* Seek from current position.  */
  120. #define SEEK_END    2    /* Seek from end of file.  */
  121.  
  122.  
  123. #if defined __USE_SVID || defined __USE_XOPEN
  124. /* Default path prefix for `tempnam' and `tmpnam'.  */
  125. # define P_tmpdir    "/tmp"
  126. #endif
  127.  
  128.  
  129. /* Get the values:
  130.    L_tmpnam    How long an array of chars must be to be passed to `tmpnam'.
  131.    TMP_MAX    The minimum number of unique filenames generated by tmpnam
  132.            (and tempnam when it uses tmpnam's name space),
  133.         or tempnam (the two are separate).
  134.    L_ctermid    How long an array to pass to `ctermid'.
  135.    L_cuserid    How long an array to pass to `cuserid'.
  136.    FOPEN_MAX    Minimum number of files that can be open at once.
  137.    FILENAME_MAX    Maximum length of a filename.  */
  138. #include <bits/stdio_lim.h>
  139.  
  140.  
  141. /* Standard streams.  */
  142. extern struct _IO_FILE *stdin;        /* Standard input stream.  */
  143. extern struct _IO_FILE *stdout;        /* Standard output stream.  */
  144. extern struct _IO_FILE *stderr;        /* Standard error output stream.  */
  145. /* C89/C99 say they're macros.  Make them happy.  */
  146. #define stdin stdin
  147. #define stdout stdout
  148. #define stderr stderr
  149.  
  150. __BEGIN_NAMESPACE_STD
  151. /* Remove file FILENAME.  */
  152. extern int remove (__const char *__filename) __THROW;
  153. /* Rename file OLD to NEW.  */
  154. extern int rename (__const char *__old, __const char *__new) __THROW;
  155. __END_NAMESPACE_STD
  156.  
  157.  
  158. __BEGIN_NAMESPACE_STD
  159. /* Create a temporary file and open it read/write.
  160.  
  161.    This function is a possible cancellation points and therefore not
  162.    marked with __THROW.  */
  163. #ifndef __USE_FILE_OFFSET64
  164. extern FILE *tmpfile (void);
  165. #else
  166. # ifdef __REDIRECT
  167. extern FILE *__REDIRECT (tmpfile, (void), tmpfile64);
  168. # else
  169. #  define tmpfile tmpfile64
  170. # endif
  171. #endif
  172.  
  173. #ifdef __USE_LARGEFILE64
  174. extern FILE *tmpfile64 (void);
  175. #endif
  176.  
  177. /* Generate a temporary filename.  */
  178. extern char *tmpnam (char *__s) __THROW;
  179. __END_NAMESPACE_STD
  180.  
  181. #ifdef __USE_MISC
  182. /* This is the reentrant variant of `tmpnam'.  The only difference is
  183.    that it does not allow S to be NULL.  */
  184. extern char *tmpnam_r (char *__s) __THROW;
  185. #endif
  186.  
  187.  
  188. #if defined __USE_SVID || defined __USE_XOPEN
  189. /* Generate a unique temporary filename using up to five characters of PFX
  190.    if it is not NULL.  The directory to put this file in is searched for
  191.    as follows: First the environment variable "TMPDIR" is checked.
  192.    If it contains the name of a writable directory, that directory is used.
  193.    If not and if DIR is not NULL, that value is checked.  If that fails,
  194.    P_tmpdir is tried and finally "/tmp".  The storage for the filename
  195.    is allocated by `malloc'.  */
  196. extern char *tempnam (__const char *__dir, __const char *__pfx)
  197.      __THROW __attribute_malloc__;
  198. #endif
  199.  
  200.  
  201. __BEGIN_NAMESPACE_STD
  202. /* Close STREAM.
  203.  
  204.    This function is a possible cancellation point and therefore not
  205.    marked with __THROW.  */
  206. extern int fclose (FILE *__stream);
  207. /* Flush STREAM, or all streams if STREAM is NULL.
  208.  
  209.    This function is a possible cancellation point and therefore not
  210.    marked with __THROW.  */
  211. extern int fflush (FILE *__stream);
  212. __END_NAMESPACE_STD
  213.  
  214. #ifdef __USE_MISC
  215. /* Faster versions when locking is not required.
  216.  
  217.    This function is not part of POSIX and therefore no official
  218.    cancellation point.  But due to similarity with an POSIX interface
  219.    or due to the implementation it is a cancellation point and
  220.    therefore not marked with __THROW.  */
  221. extern int fflush_unlocked (FILE *__stream);
  222. #endif
  223.  
  224. #ifdef __USE_GNU
  225. /* Close all streams.
  226.  
  227.    This function is not part of POSIX and therefore no official
  228.    cancellation point.  But due to similarity with an POSIX interface
  229.    or due to the implementation it is a cancellation point and
  230.    therefore not marked with __THROW.  */
  231. extern int fcloseall (void);
  232. #endif
  233.  
  234.  
  235. __BEGIN_NAMESPACE_STD
  236. #ifndef __USE_FILE_OFFSET64
  237. /* Open a file and create a new stream for it.
  238.  
  239.    This function is a possible cancellation point and therefore not
  240.    marked with __THROW.  */
  241. extern FILE *fopen (__const char *__restrict __filename,
  242.             __const char *__restrict __modes);
  243. /* Open a file, replacing an existing stream with it.
  244.  
  245.    This function is a possible cancellation point and therefore not
  246.    marked with __THROW.  */
  247. extern FILE *freopen (__const char *__restrict __filename,
  248.               __const char *__restrict __modes,
  249.               FILE *__restrict __stream);
  250. #else
  251. # ifdef __REDIRECT
  252. extern FILE *__REDIRECT (fopen, (__const char *__restrict __filename,
  253.                  __const char *__restrict __modes), fopen64);
  254. extern FILE *__REDIRECT (freopen, (__const char *__restrict __filename,
  255.                    __const char *__restrict __modes,
  256.                    FILE *__restrict __stream), freopen64);
  257. # else
  258. #  define fopen fopen64
  259. #  define freopen freopen64
  260. # endif
  261. #endif
  262. __END_NAMESPACE_STD
  263. #ifdef __USE_LARGEFILE64
  264. extern FILE *fopen64 (__const char *__restrict __filename,
  265.               __const char *__restrict __modes);
  266. extern FILE *freopen64 (__const char *__restrict __filename,
  267.             __const char *__restrict __modes,
  268.             FILE *__restrict __stream);
  269. #endif
  270.  
  271. #ifdef    __USE_POSIX
  272. /* Create a new stream that refers to an existing system file descriptor.  */
  273. extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
  274. #endif
  275.  
  276. #ifdef    __USE_GNU
  277. /* Create a new stream that refers to the given magic cookie,
  278.    and uses the given functions for input and output.  */
  279. extern FILE *fopencookie (void *__restrict __magic_cookie,
  280.               __const char *__restrict __modes,
  281.               _IO_cookie_io_functions_t __io_funcs) __THROW;
  282.  
  283. /* Create a new stream that refers to a memory buffer.  */
  284. extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) __THROW;
  285.  
  286. /* Open a stream that writes into a malloc'd buffer that is expanded as
  287.    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
  288.    and the number of characters written on fflush or fclose.  */
  289. extern FILE *open_memstream (char **__restrict __bufloc,
  290.                  size_t *__restrict __sizeloc) __THROW;
  291. #endif
  292.  
  293.  
  294. __BEGIN_NAMESPACE_STD
  295. /* If BUF is NULL, make STREAM unbuffered.
  296.    Else make it use buffer BUF, of size BUFSIZ.  */
  297. extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
  298. /* Make STREAM use buffering mode MODE.
  299.    If BUF is not NULL, use N bytes of it for buffering;
  300.    else allocate an internal buffer N bytes long.  */
  301. extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
  302.             int __modes, size_t __n) __THROW;
  303. __END_NAMESPACE_STD
  304.  
  305. #ifdef    __USE_BSD
  306. /* If BUF is NULL, make STREAM unbuffered.
  307.    Else make it use SIZE bytes of BUF for buffering.  */
  308. extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
  309.                size_t __size) __THROW;
  310.  
  311. /* Make STREAM line-buffered.  */
  312. extern void setlinebuf (FILE *__stream) __THROW;
  313. #endif
  314.  
  315.  
  316. __BEGIN_NAMESPACE_STD
  317. /* Write formatted output to STREAM.
  318.  
  319.    This function is a possible cancellation point and therefore not
  320.    marked with __THROW.  */
  321. extern int fprintf (FILE *__restrict __stream,
  322.             __const char *__restrict __format, ...);
  323. /* Write formatted output to stdout.
  324.  
  325.    This function is a possible cancellation point and therefore not
  326.    marked with __THROW.  */
  327. extern int printf (__const char *__restrict __format, ...);
  328. /* Write formatted output to S.  */
  329. extern int sprintf (char *__restrict __s,
  330.             __const char *__restrict __format, ...) __THROW;
  331.  
  332. /* Write formatted output to S from argument list ARG.
  333.  
  334.    This function is a possible cancellation point and therefore not
  335.    marked with __THROW.  */
  336. extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
  337.              _G_va_list __arg);
  338. /* Write formatted output to stdout from argument list ARG.
  339.  
  340.    This function is a possible cancellation point and therefore not
  341.    marked with __THROW.  */
  342. extern int vprintf (__const char *__restrict __format, _G_va_list __arg);
  343. /* Write formatted output to S from argument list ARG.  */
  344. extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
  345.              _G_va_list __arg) __THROW;
  346. __END_NAMESPACE_STD
  347.  
  348. #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
  349. __BEGIN_NAMESPACE_C99
  350. /* Maximum chars of output to write in MAXLEN.  */
  351. extern int snprintf (char *__restrict __s, size_t __maxlen,
  352.              __const char *__restrict __format, ...)
  353.      __THROW __attribute__ ((__format__ (__printf__, 3, 4)));
  354.  
  355. extern int vsnprintf (char *__restrict __s, size_t __maxlen,
  356.               __const char *__restrict __format, _G_va_list __arg)
  357.      __THROW __attribute__ ((__format__ (__printf__, 3, 0)));
  358. __END_NAMESPACE_C99
  359. #endif
  360.  
  361. #ifdef __USE_GNU
  362. /* Write formatted output to a string dynamically allocated with `malloc'.
  363.    Store the address of the string in *PTR.  */
  364. extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
  365.               _G_va_list __arg)
  366.      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
  367. extern int __asprintf (char **__restrict __ptr,
  368.                __const char *__restrict __fmt, ...)
  369.      __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
  370. extern int asprintf (char **__restrict __ptr,
  371.              __const char *__restrict __fmt, ...)
  372.      __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
  373.  
  374. /* Write formatted output to a file descriptor.
  375.  
  376.    These functions are not part of POSIX and therefore no official
  377.    cancellation point.  But due to similarity with an POSIX interface
  378.    or due to the implementation they are cancellation points and
  379.    therefore not marked with __THROW.  */
  380. extern int vdprintf (int __fd, __const char *__restrict __fmt,
  381.              _G_va_list __arg)
  382.      __attribute__ ((__format__ (__printf__, 2, 0)));
  383. extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
  384.      __attribute__ ((__format__ (__printf__, 2, 3)));
  385. #endif
  386.  
  387.  
  388. __BEGIN_NAMESPACE_STD
  389. /* Read formatted input from STREAM.
  390.  
  391.    This function is a possible cancellation point and therefore not
  392.    marked with __THROW.  */
  393. extern int fscanf (FILE *__restrict __stream,
  394.            __const char *__restrict __format, ...);
  395. /* Read formatted input from stdin.
  396.  
  397.    This function is a possible cancellation point and therefore not
  398.    marked with __THROW.  */
  399. extern int scanf (__const char *__restrict __format, ...);
  400. /* Read formatted input from S.  */
  401. extern int sscanf (__const char *__restrict __s,
  402.            __const char *__restrict __format, ...) __THROW;
  403. __END_NAMESPACE_STD
  404.  
  405. #ifdef    __USE_ISOC99
  406. __BEGIN_NAMESPACE_C99
  407. /* Read formatted input from S into argument list ARG.
  408.  
  409.    This function is a possible cancellation point and therefore not
  410.    marked with __THROW.  */
  411. extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
  412.             _G_va_list __arg)
  413.      __attribute__ ((__format__ (__scanf__, 2, 0)));
  414.  
  415. /* Read formatted input from stdin into argument list ARG.
  416.  
  417.    This function is a possible cancellation point and therefore not
  418.    marked with __THROW.  */
  419. extern int vscanf (__const char *__restrict __format, _G_va_list __arg)
  420.      __attribute__ ((__format__ (__scanf__, 1, 0)));
  421.  
  422. /* Read formatted input from S into argument list ARG.  */
  423. extern int vsscanf (__const char *__restrict __s,
  424.             __const char *__restrict __format, _G_va_list __arg)
  425.      __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
  426. __END_NAMESPACE_C99
  427. #endif /* Use ISO C9x.  */
  428.  
  429.  
  430. __BEGIN_NAMESPACE_STD
  431. /* Read a character from STREAM.
  432.  
  433.    These functions are possible cancellation points and therefore not
  434.    marked with __THROW.  */
  435. extern int fgetc (FILE *__stream);
  436. extern int getc (FILE *__stream);
  437.  
  438. /* Read a character from stdin.
  439.  
  440.    This function is a possible cancellation point and therefore not
  441.    marked with __THROW.  */
  442. extern int getchar (void);
  443. __END_NAMESPACE_STD
  444.  
  445. /* The C standard explicitly says this is a macro, so we always do the
  446.    optimization for it.  */
  447. #define getc(_fp) _IO_getc (_fp)
  448.  
  449. #if defined __USE_POSIX || defined __USE_MISC
  450. /* These are defined in POSIX.1:1996.
  451.  
  452.    These functions are possible cancellation points and therefore not
  453.    marked with __THROW.  */
  454. extern int getc_unlocked (FILE *__stream);
  455. extern int getchar_unlocked (void);
  456. #endif /* Use POSIX or MISC.  */
  457.  
  458. #ifdef __USE_MISC
  459. /* Faster version when locking is not necessary.
  460.  
  461.    This function is not part of POSIX and therefore no official
  462.    cancellation point.  But due to similarity with an POSIX interface
  463.    or due to the implementation it is a cancellation point and
  464.    therefore not marked with __THROW.  */
  465. extern int fgetc_unlocked (FILE *__stream);
  466. #endif /* Use MISC.  */
  467.  
  468.  
  469. __BEGIN_NAMESPACE_STD
  470. /* Write a character to STREAM.
  471.  
  472.    These functions are possible cancellation points and therefore not
  473.    marked with __THROW.
  474.  
  475.    These functions is a possible cancellation point and therefore not
  476.    marked with __THROW.  */
  477. extern int fputc (int __c, FILE *__stream);
  478. extern int putc (int __c, FILE *__stream);
  479.  
  480. /* Write a character to stdout.
  481.  
  482.    This function is a possible cancellation point and therefore not
  483.    marked with __THROW.  */
  484. extern int putchar (int __c);
  485. __END_NAMESPACE_STD
  486.  
  487. /* The C standard explicitly says this can be a macro,
  488.    so we always do the optimization for it.  */
  489. #define putc(_ch, _fp) _IO_putc (_ch, _fp)
  490.  
  491. #ifdef __USE_MISC
  492. /* Faster version when locking is not necessary.
  493.  
  494.    This function is not part of POSIX and therefore no official
  495.    cancellation point.  But due to similarity with an POSIX interface
  496.    or due to the implementation it is a cancellation point and
  497.    therefore not marked with __THROW.  */
  498. extern int fputc_unlocked (int __c, FILE *__stream);
  499. #endif /* Use MISC.  */
  500.  
  501. #if defined __USE_POSIX || defined __USE_MISC
  502. /* These are defined in POSIX.1:1996.
  503.  
  504.    These functions are possible cancellation points and therefore not
  505.    marked with __THROW.  */
  506. extern int putc_unlocked (int __c, FILE *__stream);
  507. extern int putchar_unlocked (int __c);
  508. #endif /* Use POSIX or MISC.  */
  509.  
  510.  
  511. #if defined __USE_SVID || defined __USE_MISC \
  512.     || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
  513. /* Get a word (int) from STREAM.  */
  514. extern int getw (FILE *__stream);
  515.  
  516. /* Write a word (int) to STREAM.  */
  517. extern int putw (int __w, FILE *__stream);
  518. #endif
  519.  
  520.  
  521. __BEGIN_NAMESPACE_STD
  522. /* Get a newline-terminated string of finite length from STREAM.
  523.  
  524.    This function is a possible cancellation point and therefore not
  525.    marked with __THROW.  */
  526. extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream);
  527.  
  528. /* Get a newline-terminated string from stdin, removing the newline.
  529.    DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.
  530.  
  531.    This function is a possible cancellation point and therefore not
  532.    marked with __THROW.  */
  533. extern char *gets (char *__s);
  534. __END_NAMESPACE_STD
  535.  
  536. #ifdef __USE_GNU
  537. /* This function does the same as `fgets' but does not lock the stream.
  538.  
  539.    This function is not part of POSIX and therefore no official
  540.    cancellation point.  But due to similarity with an POSIX interface
  541.    or due to the implementation it is a cancellation point and
  542.    therefore not marked with __THROW.  */
  543. extern char *fgets_unlocked (char *__restrict __s, int __n,
  544.                  FILE *__restrict __stream);
  545. #endif
  546.  
  547.  
  548. #ifdef    __USE_GNU
  549. /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
  550.    (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
  551.    NULL), pointing to *N characters of space.  It is realloc'd as
  552.    necessary.  Returns the number of characters read (not including the
  553.    null terminator), or -1 on error or EOF.
  554.  
  555.    These functions are not part of POSIX and therefore no official
  556.    cancellation point.  But due to similarity with an POSIX interface
  557.    or due to the implementation they are cancellation points and
  558.    therefore not marked with __THROW.  */
  559. extern _IO_ssize_t __getdelim (char **__restrict __lineptr,
  560.                    size_t *__restrict __n, int __delimiter,
  561.                    FILE *__restrict __stream);
  562. extern _IO_ssize_t getdelim (char **__restrict __lineptr,
  563.                  size_t *__restrict __n, int __delimiter,
  564.                  FILE *__restrict __stream);
  565.  
  566. /* Like `getdelim', but reads up to a newline.
  567.  
  568.    This function is not part of POSIX and therefore no official
  569.    cancellation point.  But due to similarity with an POSIX interface
  570.    or due to the implementation it is a cancellation point and
  571.    therefore not marked with __THROW.  */
  572. extern _IO_ssize_t getline (char **__restrict __lineptr,
  573.                 size_t *__restrict __n,
  574.                 FILE *__restrict __stream);
  575. #endif
  576.  
  577.  
  578. __BEGIN_NAMESPACE_STD
  579. /* Write a string to STREAM.
  580.  
  581.    This function is a possible cancellation points and therefore not
  582.    marked with __THROW.  */
  583. extern int fputs (__const char *__restrict __s, FILE *__restrict __stream);
  584.  
  585. /* Write a string, followed by a newline, to stdout.
  586.  
  587.    This function is a possible cancellation points and therefore not
  588.    marked with __THROW.  */
  589. extern int puts (__const char *__s);
  590.  
  591.  
  592. /* Push a character back onto the input buffer of STREAM.
  593.  
  594.    This function is a possible cancellation points and therefore not
  595.    marked with __THROW.  */
  596. extern int ungetc (int __c, FILE *__stream);
  597.  
  598.  
  599. /* Read chunks of generic data from STREAM.
  600.  
  601.    This function is a possible cancellation points and therefore not
  602.    marked with __THROW.  */
  603. extern size_t fread (void *__restrict __ptr, size_t __size,
  604.              size_t __n, FILE *__restrict __stream);
  605. /* Write chunks of generic data to STREAM.
  606.  
  607.    This function is a possible cancellation points and therefore not
  608.    marked with __THROW.  */
  609. extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
  610.               size_t __n, FILE *__restrict __s);
  611. __END_NAMESPACE_STD
  612.  
  613. #ifdef __USE_GNU
  614. /* This function does the same as `fputs' but does not lock the stream.
  615.  
  616.    This function is not part of POSIX and therefore no official
  617.    cancellation point.  But due to similarity with an POSIX interface
  618.    or due to the implementation it is a cancellation point and
  619.    therefore not marked with __THROW.  */
  620. extern int fputs_unlocked (__const char *__restrict __s,
  621.                FILE *__restrict __stream);
  622. #endif
  623.  
  624. #ifdef __USE_MISC
  625. /* Faster versions when locking is not necessary.
  626.  
  627.    These functions are not part of POSIX and therefore no official
  628.    cancellation point.  But due to similarity with an POSIX interface
  629.    or due to the implementation they are cancellation points and
  630.    therefore not marked with __THROW.  */
  631. extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
  632.                   size_t __n, FILE *__restrict __stream);
  633. extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
  634.                    size_t __n, FILE *__restrict __stream);
  635. #endif
  636.  
  637.  
  638. __BEGIN_NAMESPACE_STD
  639. /* Seek to a certain position on STREAM.
  640.  
  641.    This function is a possible cancellation point and therefore not
  642.    marked with __THROW.  */
  643. extern int fseek (FILE *__stream, long int __off, int __whence);
  644. /* Return the current position of STREAM.
  645.  
  646.    This function is a possible cancellation point and therefore not
  647.    marked with __THROW.  */
  648. extern long int ftell (FILE *__stream);
  649. /* Rewind to the beginning of STREAM.
  650.  
  651.    This function is a possible cancellation point and therefore not
  652.    marked with __THROW.  */
  653. extern void rewind (FILE *__stream);
  654. __END_NAMESPACE_STD
  655.  
  656. /* The Single Unix Specification, Version 2, specifies an alternative,
  657.    more adequate interface for the two functions above which deal with
  658.    file offset.  `long int' is not the right type.  These definitions
  659.    are originally defined in the Large File Support API.  */
  660.  
  661. #if defined __USE_LARGEFILE || defined __USE_XOPEN2K
  662. # ifndef __USE_FILE_OFFSET64
  663. /* Seek to a certain position on STREAM.
  664.  
  665.    This function is a possible cancellation point and therefore not
  666.    marked with __THROW.  */
  667. extern int fseeko (FILE *__stream, __off_t __off, int __whence);
  668. /* Return the current position of STREAM.
  669.  
  670.    This function is a possible cancellation point and therefore not
  671.    marked with __THROW.  */
  672. extern __off_t ftello (FILE *__stream);
  673. # else
  674. #  ifdef __REDIRECT
  675. extern int __REDIRECT (fseeko,
  676.                (FILE *__stream, __off64_t __off, int __whence),
  677.                fseeko64);
  678. extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
  679. #  else
  680. #   define fseeko fseeko64
  681. #   define ftello ftello64
  682. #  endif
  683. # endif
  684. #endif
  685.  
  686. __BEGIN_NAMESPACE_STD
  687. #ifndef __USE_FILE_OFFSET64
  688. /* Get STREAM's position.
  689.  
  690.    This function is a possible cancellation point and therefore not
  691.    marked with __THROW.  */
  692. extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);
  693. /* Set STREAM's position.
  694.  
  695.    This function is a possible cancellation point and therefore not
  696.    marked with __THROW.  */
  697. extern int fsetpos (FILE *__stream, __const fpos_t *__pos);
  698. #else
  699. # ifdef __REDIRECT
  700. extern int __REDIRECT (fgetpos, (FILE *__restrict __stream,
  701.                  fpos_t *__restrict __pos), fgetpos64);
  702. extern int __REDIRECT (fsetpos,
  703.                (FILE *__stream, __const fpos_t *__pos), fsetpos64);
  704. # else
  705. #  define fgetpos fgetpos64
  706. #  define fsetpos fsetpos64
  707. # endif
  708. #endif
  709. __END_NAMESPACE_STD
  710.  
  711. #ifdef __USE_LARGEFILE64
  712. extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
  713. extern __off64_t ftello64 (FILE *__stream);
  714. extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
  715. extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos);
  716. #endif
  717.  
  718. __BEGIN_NAMESPACE_STD
  719. /* Clear the error and EOF indicators for STREAM.  */
  720. extern void clearerr (FILE *__stream) __THROW;
  721. /* Return the EOF indicator for STREAM.  */
  722. extern int feof (FILE *__stream) __THROW;
  723. /* Return the error indicator for STREAM.  */
  724. extern int ferror (FILE *__stream) __THROW;
  725. __END_NAMESPACE_STD
  726.  
  727. #ifdef __USE_MISC
  728. /* Faster versions when locking is not required.  */
  729. extern void clearerr_unlocked (FILE *__stream) __THROW;
  730. extern int feof_unlocked (FILE *__stream) __THROW;
  731. extern int ferror_unlocked (FILE *__stream) __THROW;
  732. #endif
  733.  
  734.  
  735. __BEGIN_NAMESPACE_STD
  736. /* Print a message describing the meaning of the value of errno.
  737.  
  738.    This function is a possible cancellation point and therefore not
  739.    marked with __THROW.  */
  740. extern void perror (__const char *__s);
  741. __END_NAMESPACE_STD
  742.  
  743. /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
  744.    are available on this system.  Even if available, these variables
  745.    should not be used directly.  The `strerror' function provides
  746.    all the necessary functionality.  */
  747. #include <bits/sys_errlist.h>
  748.  
  749.  
  750. #ifdef    __USE_POSIX
  751. /* Return the system file descriptor for STREAM.  */
  752. extern int fileno (FILE *__stream) __THROW;
  753. #endif /* Use POSIX.  */
  754.  
  755. #ifdef __USE_MISC
  756. /* Faster version when locking is not required.  */
  757. extern int fileno_unlocked (FILE *__stream) __THROW;
  758. #endif
  759.  
  760.  
  761. #if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
  762.      defined __USE_MISC)
  763. /* Create a new stream connected to a pipe running the given command.
  764.  
  765.    This function is a possible cancellation point and therefore not
  766.    marked with __THROW.  */
  767. extern FILE *popen (__const char *__command, __const char *__modes);
  768.  
  769. /* Close a stream opened by popen and return the status of its child.
  770.  
  771.    This function is a possible cancellation point and therefore not
  772.    marked with __THROW.  */
  773. extern int pclose (FILE *__stream);
  774. #endif
  775.  
  776.  
  777. #ifdef    __USE_POSIX
  778. /* Return the name of the controlling terminal.  */
  779. extern char *ctermid (char *__s) __THROW;
  780. #endif /* Use POSIX.  */
  781.  
  782.  
  783. #ifdef __USE_XOPEN
  784. /* Return the name of the current user.  */
  785. extern char *cuserid (char *__s);
  786. #endif /* Use X/Open, but not issue 6.  */
  787.  
  788.  
  789. #ifdef    __USE_GNU
  790. struct obstack;            /* See <obstack.h>.  */
  791.  
  792. /* Write formatted output to an obstack.  */
  793. extern int obstack_printf (struct obstack *__restrict __obstack,
  794.                __const char *__restrict __format, ...)
  795.      __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
  796. extern int obstack_vprintf (struct obstack *__restrict __obstack,
  797.                 __const char *__restrict __format,
  798.                 _G_va_list __args)
  799.      __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
  800. #endif /* Use GNU.  */
  801.  
  802.  
  803. #if defined __USE_POSIX || defined __USE_MISC
  804. /* These are defined in POSIX.1:1996.  */
  805.  
  806. /* Acquire ownership of STREAM.  */
  807. extern void flockfile (FILE *__stream) __THROW;
  808.  
  809. /* Try to acquire ownership of STREAM but do not block if it is not
  810.    possible.  */
  811. extern int ftrylockfile (FILE *__stream) __THROW;
  812.  
  813. /* Relinquish the ownership granted for STREAM.  */
  814. extern void funlockfile (FILE *__stream) __THROW;
  815. #endif /* POSIX || misc */
  816.  
  817. #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
  818. /* The X/Open standard requires some functions and variables to be
  819.    declared here which do not belong into this header.  But we have to
  820.    follow.  In GNU mode we don't do this nonsense.  */
  821. # define __need_getopt
  822. # include <getopt.h>
  823. #endif    /* X/Open, but not issue 6 and not for GNU.  */
  824.  
  825. /* If we are compiling with optimizing read this file.  It contains
  826.    several optimizing inline functions and macros.  */
  827. #ifdef __USE_EXTERN_INLINES
  828. # include <bits/stdio.h>
  829. #endif
  830. #if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus
  831. # include <bits/stdio2.h>
  832. #endif
  833.  
  834. __END_DECLS
  835.  
  836. #endif /* <stdio.h> included.  */
  837.  
  838. #endif /* !_STDIO_H */
  839.